package net.csdn.www;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import javax.imageio.ImageIO;
import javax.swing.JFileChooser;

public class Test02 {

	public Test02() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * 刘柱栋    2013-3-4
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		String urlStr = "http://www.baidu.com";
		try {
			URL url = new URL(urlStr);
			URLConnection urlConn = url.openConnection();
			urlConn.connect();
			BufferedReader bufReader = new BufferedReader(new InputStreamReader(urlConn.getInputStream()));
			do{
				String str = bufReader.readLine();
				System.out.println(str);
				
			}while(bufReader.read() != -1);
//			StringTokenizer tokenizer = null;
//			String nextLine = null;
//			while((nextLine = bufReader.readLine()) != null){
//				tokenizer = new StringTokenizer(nextLine);
//				while(tokenizer.hasMoreTokens()){
//					String str = tokenizer.nextToken();
//					System.out.println("==================================================");
//					System.out.println(str);
//				}
//				
//			}
		} catch (MalformedURLException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

}
